<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Warehouse Transfer IN </title>
<script language="javascript">
function enableUpload(){
	document.getElementById("sub_upload").disabled = false;
	}

</script>
</head>
<body style="font-family:Arial, Helvetica, sans-serif;">

<h1>ERROR CORRECTION (EI) <span style="color:#F00;">INCREASE ONLY</span><br />
</h1>
<p>
<span style="color:#F00"><?php echo $this->errorMessage;?></span><br />
  ***********************************<br />
This is the Parts That you DID NOT USE, <br />
after scan this ,<br />
you should using &quot;parts record&quot; in &quot;show status&quot; to scan the correct part(s) again.<br />
<br />
You <strong>MUST INPUT</strong> Job ID ,otherwise it will NOT BE SAVE <br />
*********************************** </p>
<p><br />
  
  <?php
$arrProducts = array();
$end = 0;

if($_POST){
	//unset($arrProducts);
	$arrProducts = unserialize(base64_decode(trim($_POST['saved_arr'])));
	//echo $_POST['saved_arr'];
	$end = count($arrProducts);
	$tmpstr = trim($_POST['barcode_code'])."[".trim($_POST['barcode_qty'])."]";
	$arrProducts[$end] = $tmpstr;
	//var_dump($arrProducts);	
	}
if(isset($_GET['rm'])){
	
	$i = $_GET['rm'];
	//echo $i;
	$arrProducts = unserialize(base64_decode(trim($_GET['data'])));
	array_splice($arrProducts,$i,1);
	}	

?>
</p>
<table width="600" border="0" cellspacing="1" cellpadding="5" bgcolor="#333">
<tr>
    <td bgcolor="#FFFFFF">Scan BarCode:</td>
    <td bgcolor="#FFFFFF">
    <form id="form1" name="form1" method="post" action="/repairparts/error-fix/shop/<?php echo $this->idshop?>/jobid/<?php echo $this->idjob?>">
      <input type="text" name="barcode_code" id="barcode_code" /> 
      Qty:
[      
<label for="textfield2"></label>
      <input type="text" name="barcode_qty" id="barcode_qty" width="50" value="1" />
      ]
       <input type="hidden" name="saved_arr" id="saved_arr" value="<?php echo base64_encode(trim(serialize($arrProducts)));?>"/>
      <input type="button" name="button" id="button" value="Add Record" onclick="javascript:document.form1.submit();" />
      </form>
      </td>
  </tr>
  <tr>
    <td width="150" bgcolor="#FFFFFF">Records to Upload:</td>
    <td bgcolor="#FFFFFF"><form id="form2" name="form2" method="post" action="/repairparts/save-shop-ei" >

      <table width="100%" border="0" cellspacing="0" cellpadding="3">
        <tr>
          <td style="width:40%">Shop ID:</td>
          <td><label for="id_shop"></label>
            <input name="id_shop" type="text" id="id_shop" value="<?php echo $this->idshop ?>" readonly="readonly" /></td>
        </tr>
        <tr>
          <td>Job ID: </td>
          <td><input name="id_job" type="text" id="id_job" value="<?php echo $this->idjob ?>" /></td>
        </tr>
        <tr>
          <td>Staff Name:</td>
          <td><input type="text" name="staff_name" id="staff_name" onchange="enableUpload()" />
          </td>
        </tr>
      </table>
      <p>
        
        <input name="sub_upload" id="sub_upload" value="SAVE THESE RECORDS" type="submit" disabled="disabled" /><br />
        <br />
        Record For Upload to Database<br /> 
      </p>
      <hr />
    <?php
	
    foreach($arrProducts as $key => $value){
			echo $value;
			echo "<input type=\"hidden\" name=\"upload[]\" value=\"".$value."\" />";
			echo "<a href=\"?rm=".$key."&data=".base64_encode(trim(serialize($arrProducts)))."\">Remove</a><br />";
		}
	
	?> 
    <br />

    
    </form></td>
  </tr>
  
</table>
    <script language="javascript">
    document.getElementById('barcode_code').focus(); 
    </script>
</body>
</html>
